<?php

class MenuButton extends EasyUIMenuButton {
    private $subMenu = null;

    /************************************************************************
     ************************** PUBLIC FUNCTIONS ****************************
     ************************************************************************/

    public function __construct($text) {
        parent::__construct($text);
    }


    public function setSubMenu($subMenu) {
        $this->subMenu = $subMenu;
        $this->setMenuId($subMenu->getId());
    }


    /**
     * creates the button with all available options
     * @return unknown
     */
    public function create() {
        $output = '<a ';
        $output .= $this->getIdTag();
        $output .= 'class="easyui-menubutton" ';
        $output .= $this->getDataOptionTag();
        $output .= $this->getActionTag();
        $output .= $this->getStyleTag();
        $output .= '>' . $this->getText() . '</a>';

        $output .= $this->subMenu->create();
        return $output;
    }
}